package com.songlanyun.modules.keywordsearch.controller.api;

import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;
import com.songlanyun.modules.keywordsearch.entity.SystemKeyWordSearch;
import com.songlanyun.modules.keywordsearch.service.SystemKeyWordSearchService;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
import java.util.Map;


/**
 * 关键词搜索
 *
 * @author zx
 * @email 
 * @date 2021-03-06 11:32:25
 */
@RestController
@RequestMapping("api/keyword/search")
public class SystemKeyWordSearchController {
    @Autowired
    private SystemKeyWordSearchService systemKeyWordSearchService;

    /**
     * 搜索推荐词
     */
    @GetMapping("/list")
    public R page(@RequestParam("limit") Integer limit){
        List<SystemKeyWordSearch> systemKeyWordSearches = systemKeyWordSearchService.loadList(limit);
        return R.ok().put("list", systemKeyWordSearches);
    }


    /**
     * 保存
     */
    @PutMapping("/save/{keyWord}")
    public R save(@PathVariable("keyWord") String keyWord){
		systemKeyWordSearchService.saveKeyWord(keyWord);
        return R.ok();
    }


}
